1 00:00:00,210 --> 00:00:05,520 In this video, I'm going to introduce climbing to our path, finding something that doesn't happen 2 00:00:05,520 --> 00:00:06,500 by default. 3 00:00:06,510 --> 00:00:08,100 So I made a ladder. 4 00:00:08,100 --> 00:00:16,230 I put it in the resources and I saved it off as an RB file, which you can download to your computer. 5 00:00:16,440 --> 00:00:25,350 Then go to your workspace, right click insert from file, find it wherever you put it on your computer. 6 00:00:25,350 --> 00:00:31,260 So you got to remember simple ladder open and then you have a ladder. 7 00:00:32,400 --> 00:00:33,960 Let's go ahead and move that ladder. 8 00:00:36,840 --> 00:00:38,160 And you can build your own ladder. 9 00:00:38,340 --> 00:00:43,290 Ladders aren't that hard, but if you don't feel like doing it, you just want to learn pathfinding. 10 00:00:43,290 --> 00:00:44,910 You're like, Man, I want to build a ladder. 11 00:00:44,910 --> 00:00:48,030 There's one right here and I'll just move that up against. 12 00:00:48,030 --> 00:00:53,610 So to show that this doesn't happen automatically, this climbing doesn't happen automatically, let's 13 00:00:53,610 --> 00:00:57,960 block him off, hit the scale, turn collisions back off. 14 00:00:58,740 --> 00:00:59,520 She's good and block. 15 00:00:59,520 --> 00:01:05,790 I mean, here now he should fail to compute a path and we have no way of knowing that if we go to our 16 00:01:05,790 --> 00:01:14,520 move NPC script and we look under follow path, you will see the case for a successful path. 17 00:01:14,520 --> 00:01:16,980 But I didn't do anything for failure. 18 00:01:17,670 --> 00:01:25,070 So let's go ahead and do that onto an ls LS and then I'll just do a printout to my console window. 19 00:01:25,080 --> 00:01:34,820 I'll say like bra, no path for me, and then we'll know that the path failed. 20 00:01:34,830 --> 00:01:36,980 Now let's go ahead and try this. 21 00:01:36,990 --> 00:01:38,100 He should get. 22 00:01:38,130 --> 00:01:42,690 He should get a failure view output window. 23 00:01:43,380 --> 00:01:44,310 There it is. 24 00:01:44,310 --> 00:01:46,020 And I will hit the play button. 25 00:01:51,910 --> 00:01:55,550 And bruh no path for me. 26 00:01:55,570 --> 00:01:58,600 He couldn't climb the ladder and he couldn't get out of the box. 27 00:01:58,600 --> 00:02:01,590 So let's get that climbing action in there. 28 00:02:01,600 --> 00:02:08,020 We have this ladder right here and we're going to need two attachments and something called a pathfinding 29 00:02:08,020 --> 00:02:11,050 link to attach to the two attachments. 30 00:02:11,050 --> 00:02:12,860 So I'm going to hit the alt. 31 00:02:12,880 --> 00:02:20,290 Click that bottom step on my ladder, and then I hit the plus on the bot. 32 00:02:20,290 --> 00:02:23,110 Step A for attachment. 33 00:02:23,290 --> 00:02:24,880 Add an attachment. 34 00:02:25,420 --> 00:02:28,110 Now I'm going to move the attachment out a little bit. 35 00:02:28,120 --> 00:02:30,580 Let's go to our home. 36 00:02:30,580 --> 00:02:31,720 Move. 37 00:02:32,660 --> 00:02:38,960 Select the attachment and it does not have to be touching the part that it's parented to. 38 00:02:38,990 --> 00:02:40,520 So I'm going to put it right here. 39 00:02:41,180 --> 00:02:43,280 And now I'm going to go to the top step. 40 00:02:44,330 --> 00:02:45,120 Bam! 41 00:02:45,320 --> 00:02:47,270 And then I do another attachment. 42 00:02:47,270 --> 00:02:49,430 I'm putting it both on on the ladder. 43 00:02:49,430 --> 00:02:51,710 So if I move the ladder around, it's still going to have the link. 44 00:02:51,710 --> 00:02:55,730 So hit the plus A for attachment. 45 00:02:56,060 --> 00:02:57,080 There we go. 46 00:02:57,080 --> 00:02:59,150 And I can move that one. 47 00:03:01,910 --> 00:03:02,640 If I can get there. 48 00:03:02,660 --> 00:03:03,180 There we go. 49 00:03:03,200 --> 00:03:04,730 Grab the attachment. 50 00:03:05,420 --> 00:03:06,350 I'll move it up. 51 00:03:07,600 --> 00:03:12,130 And I want to show that he can actually get to the wall. 52 00:03:13,420 --> 00:03:14,650 That should work. 53 00:03:15,220 --> 00:03:16,780 It doesn't have to be exact. 54 00:03:17,500 --> 00:03:18,100 All right. 55 00:03:18,100 --> 00:03:22,110 Now, on either the top or the bottom step, this will work on either one. 56 00:03:22,120 --> 00:03:23,690 We're going to hit the plus. 57 00:03:23,710 --> 00:03:27,970 We're going to do a PR and we'll look for Pathfinding link. 58 00:03:28,300 --> 00:03:28,930 There we go. 59 00:03:28,930 --> 00:03:32,170 We got the link, but it's not attached to anything. 60 00:03:32,170 --> 00:03:39,340 Luckily on the Pathfinding link, you have these two attachment spots, Attachment zero, Attachment 61 00:03:39,340 --> 00:03:40,020 one. 62 00:03:40,030 --> 00:03:49,660 So let's go to attachment zero and we'll select our top step Attachment one, bottom step attachment. 63 00:03:49,660 --> 00:03:55,540 So I just put the attachments on each of those steps in these slots right here, the properties of my 64 00:03:55,540 --> 00:03:56,710 Pathfinding link. 65 00:03:56,740 --> 00:04:02,230 Now, it doesn't matter which order you do because we're going to use a bidirectional link. 66 00:04:02,230 --> 00:04:04,210 He's not going to climb back down the ladder. 67 00:04:04,210 --> 00:04:05,290 He's just going to jump. 68 00:04:05,290 --> 00:04:08,530 But make sure that you have it. 69 00:04:08,530 --> 00:04:10,960 Bidirectional should be right here. 70 00:04:10,960 --> 00:04:11,350 Here it is. 71 00:04:11,350 --> 00:04:16,600 Bidirectional checked so you don't have to worry about which arrow it is because if it's going down, 72 00:04:16,600 --> 00:04:18,010 he's not going to go up the steps. 73 00:04:18,190 --> 00:04:18,640 All right. 74 00:04:18,640 --> 00:04:21,260 Now we are good to go. 75 00:04:21,280 --> 00:04:26,710 I did a lot of talking, didn't do a lot of coding, but we got our climbing implemented. 76 00:04:26,830 --> 00:04:28,090 Let's check it out. 77 00:04:29,410 --> 00:04:31,060 He's going to go up that ladder. 78 00:04:31,960 --> 00:04:32,480 Sweet. 79 00:04:32,500 --> 00:04:33,190 Oh, look at that. 80 00:04:33,190 --> 00:04:34,040 That's pretty tricky. 81 00:04:34,060 --> 00:04:35,620 He made it all the way around. 82 00:04:36,920 --> 00:04:38,430 That's pretty cool, though. 83 00:04:38,450 --> 00:04:40,490 So we have climbing. 84 00:04:40,490 --> 00:04:46,040 And if you're wondering about swimming, if you put in some water, the pathfinding service will allow 85 00:04:46,040 --> 00:04:48,440 swimming without a special pathfinding link. 86 00:04:48,440 --> 00:04:51,080 But if it doesn't, you could always add one. 87 00:04:51,080 --> 00:04:57,150 And if you really want to get into this, there's something called a pathfinding modifier. 88 00:04:57,170 --> 00:04:58,490 Let's take a quick look. 89 00:04:59,260 --> 00:05:07,930 So if I hit the plus and this pathfinding modifier will allow you to make some paths harder to traverse 90 00:05:07,930 --> 00:05:11,210 than others so there'll be a favoritism toward certain paths. 91 00:05:11,230 --> 00:05:13,150 That's pretty good for AI. 92 00:05:13,180 --> 00:05:15,040 So you should keep that in mind. 93 00:05:15,190 --> 00:05:15,490 All right. 94 00:05:15,490 --> 00:05:17,850 So I will see you in the next video. 95 00:05:17,860 --> 00:05:19,720 Good luck with your pathfinding.